import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const routes = [
	{
		path: '/',
		component: () => import('~/login/index'),
	},
	{
		path: '/user',
		component: () => import('@/components/layout/index'),
		children: [
			{
				path: 'index',
				component: () => import('~/user/index'),
				meta: {
					title: '用户列表',
					parentTitle: '用户管理',
				},
			},
			{
				path: 'auth-update',
				component: () => import('~/user/auth-update'),
				meta: {
					title: '用户列表',
					parentTitle: '用户管理',
				},
			},
		],
	},
	{
		path: '/role',
		component: () => import('@/components/layout/index'),
		children: [
			{
				path: 'index',
				component: () => import('~/role/index'),
				meta: {
					title: '角色列表',
					parentTitle: '角色管理',
				},
			},
		],
	},
	{
		path: '/commodity',
		component: () => import('@/components/layout/index'),
		children: [
			{
				path: 'index',
				component: () => import('~/shoppingList/index'),
				meta: {
					title: '商品列表',
					parentTitle: '商品管理',
				},
			},
		],
	},
	{
		path: '/purchase',
		component: () => import('@/components/layout/index'),
		children: [
			{
				path: 'index',
				component: () => import('~/purchase/index'),
				meta: {
					title: '采购列表',
					parentTitle: '采购管理',
				},
			},
		],
	},
	{
		path: '/instore',
		component: () => import('@/components/layout/index'),
		children: [
			{
				path: 'index',
				component: () => import('~/instore/index'),
				meta: {
					title: '入库列表',
					parentTitle: '入库管理',
				},
			},
		],
	},
	{
		path: '/outstore',
		component: () => import('@/components/layout/index'),
		children: [
			{
				path: 'index',
				component: () => import('~/outstore/index'),
				meta: {
					title: '出库列表',
					parentTitle: '出库管理',
				},
			},
		],
	},
	{
		path: '/layout',
		component: () => import('@/components/layout/index'),
		children: [
			{
				path: 'home',
				component: () => import('~/home/index'),
			},
		],
	},
];

const router = new VueRouter({
	mode: 'history',
	base: process.env.BASE_URL,
	routes,
});

export default router;
